
/* inferno's Lua API

A Lua supplement built in C++
ilapi.googlecode.com

See copyright and license at end of file!
***
Built using Lua 5.1.4.0

Declaration of ilapi namespace

iLapi.h */

#ifndef __ILAPI_H__
#define __ILAPI_H__

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

#include <cstring>
#include <iostream>
#include <stdarg.h>


namespace ilapi {
extern lua_State *L;
extern int minstack;
extern char* registeredvar[1000];
extern char* registeredvalue[1000];

extern bool init (bool, int);
extern void run();
extern void close();
extern void registercfunc (const char*, lua_CFunction);
extern void registervar (const char*);
extern void checkregisteredvar (const char*);
void exec (const char*);

namespace parse {
extern int file (const char*);
extern int string (const char*);
extern void varstring (const char*);
};

namespace table {
extern void pushnumindex (const char*, int);
extern void pushcharindex (const char*, const char*);
};

namespace get {
extern const char *string (const char*);
extern lua_Number number (const char*);
extern bool boolean (const char*);
extern void table (const char*);
};

namespace set {
extern void string (const char*, const char*);
extern void number (const char*, lua_Number);
extern void boolean (const char*, bool);
extern void nil (const char*);
};

namespace is {
extern bool string (const char*);
extern bool number (const char*);
extern bool boolean (const char*);
extern bool nil (const char*);
extern bool none (const char*);
extern bool noneornil (const char*);
extern bool table (const char*);
};

namespace push {
extern void string (const char*);
extern void number ( lua_Number);
extern void boolean (bool);
extern void nil ();
};

namespace lib {
extern void load();
extern int help (lua_State*);
extern int memory (lua_State*);
extern int print (lua_State*);
}

class ltable {
    public:
    const char *name;

    void pushnumindex (int);
    void pushcharindex (const char*);
    ltable ();
    ltable (const char*);
    ltable (const char*, int, ...);
    ~ltable();
};

class lvar {
    public:
    const char *name;
    char *value;
    ltable *parent;

    void pushvalue();
    lvar();
    lvar (const char*);
    lvar (const char*, char*);
    lvar (const char*, ltable*);
    lvar (const char*, char*, ltable*);
    ~lvar();
};

};

#endif


/******************************************************************************
* Copyright (C) 2009 inferno (RJ Johnson).  All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/
